<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
            *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }

            ul{
                overflow: hidden;

            }
            ul li{
                margin: 20px auto;
                width: 120px;;
                text-align: center;

            }
            p{
                width: 100px;
                height: 40px;
                line-height: 40px;
                text-align: center;
                display: none;

            }
            li.current{

                background: rgb(60, 195, 216);
                color: white;

            }

            p.current{
                display: block;
                text-align: center;
                margin: 1px auto;
                border: 1px solid rgb(135, 208, 225);
                
                
            }
   
    
    </style>

</head>
<body>
        <ul>
            <li class="current">934宿舍</li>
            <li>戴晓林</li>
            <li>吴国鸿</li>
            <li>林海琳</li>
            <li>苏达威</li>
            <li>伍伟燊</li>
            <li>陈创林</li>
        </ul>
        <div>
            <p class="current">编号934</p>
            <p>男、海城人</p>
            <p>男、碣石人</p>
            <p>男、谭西人</p>
            <p>男、汕尾人</p>
            <p>男、中山人</p>
            <p>男、中山人</p>
        </div>


        <script>
        
        var tags=document.getElementsByTagName('li');
        var cons=document.getElementsByTagName('p');

        for(var i=0;i<tags.length;i++){
            tags[i].zsh=i;
            tags[i].onclick=function(){
                for(var t=0;t<tags.length;t++){

                    tags[t].className='';
                    cons[t].className='';

                }
                this.className="current";
                var n=this.zsh;
                cons[n].className='current'
            }
        }
        </script>


</body>
</html>